package com.lions.client.view.gui;

import com.google.gwt.user.client.ui.RootLayoutPanel;
import com.lions.client.controller.Controller;
import com.lions.client.model.Model;

/**
 * 
 * @author Brad
 * 
 */
public class LoginHandler {

	/**
	 * Creates the MainGUI panel once correct login information has been entered.
	 */
	public LoginHandler(RootLayoutPanel rp) {
		rootLayoutPanel = rp;
		checkLogin();
		
	}
	
	/**
	 * Call this method to display the login screen.
	 * Login panel will call the loginSuccess() method if success.
	 */
	public void checkLogin() {
		login = new LoginPanel(this);
		rootLayoutPanel.add(login);
	}
	
	/**
	 * Called on a successful login
	 * Call this directly to skip the login screen (for debugging)
	 */
	public void loginSuccess() {
		Controller control = new Controller();
		rootLayoutPanel.clear();
		login = null;
		rootLayoutPanel.add(control.getMainPanel());
	}
	
	private RootLayoutPanel rootLayoutPanel;
	private LoginPanel login;
}
